package com.tyut.homework.repository;

import com.tyut.homework.pojo.StuDor;
import com.tyut.homework.pojo.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface StuDorRepository extends JpaRepository<StuDor,Integer> {


    //select apt_id,dor_id,count(stu_id) from stu_dor group by dor_id;
    @Query(value = "select s.aptId,s.dorId,count(s.stuId) from StuDor s group by s.dorId")
    List<StuDor> getDorsStatus();
}
